﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Weblications.Sango.Environment;
using Pixysoft.Web;
using Pixysoft.Weblications.Sango.Command.general;
using Pixysoft.Framework.Verifications;
using Pixysoft.Weblications.Sango.Thread;

namespace Pixysoft.Weblications.Sango
{
    public class SangoManager
    {
        static SangoManager()
        {
            Initialize();

            ThreadManager.Register();

            ContentReviewHelper.Initialize();
        }

        public static void Initialize()
        {
            SysNationHelper.initialize();
            CityNationHelper.initialize();
            CitySectionHelper.initialize();
            SysSectionHelper.initialize();
            SysSectionBattleHelper.initialize();
            SysSectionScaleHelper.initialize();

            PtyPartyBattleSettingHelper.initialize();
            PtyPartymissionHelper.initialize();
            PtyPartyResourceSettingHelper.initialize();
            PtyPartyTitleHelper.initialize();

            WarOfficerHelper.initialize();
            WarOfficerteamHelper.initialize();
            WarStageHelper.initialize();


            CityBuildingHelper.initialize();
            CityStrategyHelper.initialize();
            CtiResourceHelper.initialize();

            EqmEquipmentHelper.initialize();
            EqmGradeHelper.initialize();
            EqmLevelHelper.initialize();
            EqmExtraHelper.initialize();

            MissionHelper.initialize();

            SysChatTemplateHelper.initialize();
            SysFameSettingHelper.initialize();
            SysOfficerHelper.initialize();
            SysProfessionalHelper.initialize();
            SysProfessionalRelationHelper.initialize();

            SysQueueHelper.initialize();
            SysTacticalHelper.initialize();
            SysVipSettingHelper.initialize();


        }

        public static string GetUsercode()
        {
            return SessionHelper.Instance.GetSession<string>(StringHelper.session_profile);
        }

        /// <summary>
        /// 获取登录权限 如果不存在则抛异常
        /// </summary>
        /// <returns></returns>
        internal static string Authentication()
        {
            string usercode = GetUsercode();

            if (string.IsNullOrEmpty(usercode))
                throw Exceptions.UnexpectedResultException("authentication fail. please login first.");

            return usercode;
        }
    }
}
